<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title></title>
     <link rel="stylesheet" type="text/css" href="${path}/css/main.css">
	<link rel="stylesheet" type="text/css" href="${path}/css/mainTable.css">
	<script type="text/javascript" language="javascript" src="${path}/js/calendar/js/WdatePicker.js"></script>
	<script type="text/javascript" language="javascript" src="${path}/js/jquery.js"></script>
	<script type="text/javascript" language="javascript" src="${path}/js/jquery.blockUI.js"></script>
	<script type="text/javascript">
		function check(){
			var time_begin = document.getElementById("time_begin").value;
			if(!isDate(time_begin)){
				alert("开始日期格式不对");
				return false;
			}
				
			$.blockUI({message: '正在查询...' });
		}
		
		function isDate(vDate){
			var regular = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/;
			var isMatch = vDate.match(regular);
			if(!isMatch){
				return false;
			}
			var date = new Date(isMatch[1],isMatch[3]-1,isMatch[4]);
			
			return (date.getFullYear()==isMatch[1]&&date.getMonth()==isMatch[3]-1&&date.getDate()==isMatch[4]);
		}
	</script>
  </head>
  <body>
    <div>
    	<form id="hangupForm" name="hangupForm" method="post" action="${path }/conversion/getHangupList.action" onsubmit="return check();">
    		<p>挂断率监控</p>
    		业务长号码:
    		<select id="sp_number" name="term.sp_number">
    			<option value="">--全部--</option>
    			<c:if test="${spnumberList != null && fn:length(spnumberList) > 0}">
    				<c:forEach var="spnumber" items="${spnumberList }" varStatus="list">
    					<option value="${spnumber }" <c:if test="${spnumber eq term.sp_number }">selected</c:if>>${spnumber }</option>
    				</c:forEach>
    			</c:if>
    		</select>
    		<br />
    		拨<span style="font-family:'Times New Roman';">&nbsp;</span>打<span style="font-family:'Times New Roman';">&nbsp;</span>日<span style="font-family:'Times New Roman';">&nbsp;</span>期<span style="font-family:'Times New Roman';">&nbsp;</span>:
    		<input type="text" id="time_begin" name="term.time_begin" value="${term.time_begin }" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false,readOnly:true})" size="10" maxlength="10" readonly="readonly" />
    		<input type="submit" name="go" value="查询" />
    		<table>
    			<thead>
    				<tr>
    					<th>业务长号码</th>
    					<th>拨打日期</th>
    					<th>前5总数</th>
    					<th>前10总数</th>
    					<th>前50总数</th>
    					<th>前5挂断率</th>
    					<th>前10挂断率</th>
    					<th>操作</th>
    				</tr>
    			</thead>
    			<c:choose>
    				<c:when test="${hangupRateVoList != null && fn:length(hangupRateVoList) > 0}">
    					<c:forEach var="hangupRateVo" items="${hangupRateVoList }" varStatus="list">
    						<tr style="${list.index%2 != 0 ? 'background-color: #fea;' : 'background-color: #fff;' }">
    							<td>${hangupRateVo.sp_number }</td>
		    					<td>${hangupRateVo.add_date }</td>
		    					<td>${hangupRateVo.prv_five }</td>
		    					<td>${hangupRateVo.prv_ten }</td>
		    					<td>${hangupRateVo.prv_fifty }</td>
		    					<td>${hangupRateVo.prv_five_rate }</td>
		    					<td>${hangupRateVo.prv_ten_rate }</td>
		    					<td>
		    						<a href="${path }/conversion/getProvinceHangup.action?term.sp_number=${hangupRateVo.sp_number }&term.time_begin=${term.time_begin }">分省挂断率</a>
		    						&nbsp;&nbsp;|&nbsp;&nbsp;
		    						<a href="${path }/conversion/getDetailHangup.action?term.sp_number=${hangupRateVo.sp_number }&term.time_begin=${term.time_begin }">详情</a>
		    					</td>
    						</tr>
    					</c:forEach>
    				</c:when>
    				<c:otherwise>
    					<tr>
    						<td>请输入查询条件!</td>
    					</tr>
    				</c:otherwise>
    			</c:choose>
    		</table>
    	</form>
    </div>
  </body>
</html>
